<template>
  <h1>El-单选组件</h1>
  <el-radio-group v-model="gender">
    <el-radio label="男" value="1"></el-radio>
    <el-radio label="女" value="0"></el-radio>
  </el-radio-group>
  <h4>您选择的值为:{{gender}}</h4>
  <hr>
  <el-radio-group v-model="edu">
    <el-radio-button label="学历:本科" value="bk"></el-radio-button>
    <el-radio-button label="学历:大专" value="dz"></el-radio-button>
    <el-radio-button label="学历:高中" value="gz"></el-radio-button>
    <el-radio-button label="学历:初中" value="cz"></el-radio-button>
  </el-radio-group>
  <h4>您选择的学历为:{{edu}}</h4>
  <hr>
  <el-radio-group v-model="pri">
    <el-radio-button v-for="p in arr" :label="p.title" :value="p.price"></el-radio-button>
  </el-radio-group>
  <h4>您选择的酒价为:{{pri}}</h4>
</template>

<script setup>
import {ref} from "vue";

//定义变量用来保存用户选择的性别
const gender = ref('');
//定义变量用来保存用户选择的学历
const edu = ref('bk');

const arr = ref([
  {title:'五粮液',price:500},
  {title:'茅台',price:2500},
  {title:'汾酒',price:330},
  {title:'梦之蓝',price:368}
]);
//定义变量用来保存用户选择的酒价
const pri = ref(2500);
</script>

<style scoped>

</style>